package com.qianxunclub.chapter8.config;

import com.qianxunclub.chapter8.interceptor.MyInterceptor;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zhangbin
 */
@Configuration
@AllArgsConstructor
public class WebAdapter implements WebMvcConfigurer {

    private MyInterceptor myInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myInterceptor).addPathPatterns("/api/*");
    }
}
